package com.cellulam.framework.datasource.service;

import com.cellulam.framework.core.model.Id;
import com.cellulam.framework.core.utils.BeanUtil;

import java.io.Serializable;

public abstract class BaseIdDtoService<PK, BEAN extends Serializable & Id<PK>, REQ extends Id<PK>, RESP extends Serializable>
        extends BaseDtoService<PK, BEAN, REQ, RESP> {

    @Override
    public PK save(REQ request) {
        BEAN bean = BeanUtil.copy(request, this.entityClass);
        saveBean(bean);
        request.setId(bean.getId());
        return bean.getId();

    }

    public abstract boolean delete(PK id);
}

